package com.wbl.tijianssm.controller;

import com.wbl.tijianssm.mapper.UsersMapper;
import com.wbl.tijianssm.pojo.Users;
import com.wbl.tijianssm.response.ApiRestResponse;
import com.wbl.tijianssm.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/user")
public class UsersController {

    @Autowired
    UsersService usersService;

    @ResponseBody
    @GetMapping("/getAll")
    public ApiRestResponse getUserList(){
        return usersService.getUserAll();
    }

    @ResponseBody
    @GetMapping("/getuserByuserid")
    public ApiRestResponse getuserByuserid(@RequestBody String userid){
        return usersService.getUserByuserid(userid);
    }

    @ResponseBody
    @PutMapping("/editPassword")
    public ApiRestResponse editPassword(@RequestBody Users user){
        System.out.println(user);
        return usersService.editPassword(user);
    }
}
